home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / TOS_SRC / CONTROL.STE / NOISE.S < prev    next >
Encoding:
Text File  |  2001-02-10  |  2.8 KB  |  135 lines

  1. *
  2. *    noise.s    program to set bios variables for control panel sound
  3. *
  4.     .text
  5.     .globl    _donoise
  6.     .globl    _rsave
  7.     .globl    _set_state
  8.     .globl    _remap2
  9.  
  10. conterm    equ    $0484
  11. ucr    equ    $FFFA29
  12. tddr    equ    $FFFA25
  13. tdcr    equ    $FFFA1D
  14.  
  15. *
  16. *    donoise    Set console noise bits
  17. *
  18. *    param 0 = click on/off (word)
  19. *    param 1 = bell on/off (word)
  20. *
  21. _donoise:
  22.     bsr    super
  23.     move.w    4(sp),d0
  24.     lsl.w    #2,d0
  25.     or.w    6(sp),d0
  26.     and.b    #$0fa,conterm
  27.     or.b    d0,conterm    *set new bell and click values
  28.     bsr    unsuper
  29.     rts
  30.  
  31.  
  32. * ==================================================
  33. *      SET STATE OF RS232 PORT
  34. * ==================================================
  35.  
  36. _set_state:
  37.     move.w    #$ffff,-(sp)    * scr
  38.     move.w    #$ffff,-(sp)    * tsr
  39.     move.w    #$ffff,-(sp)    * rsc
  40.     move.w    #$ffff,-(sp)    * ucr
  41. *
  42.     lea    _rsave,a0    * flow control
  43.     move.b    4(a0),d0
  44.     ext.w    d0
  45.     move.w    d0,-(sp)    * flow control to stack
  46. *
  47.     clr.w    d0
  48.     move.b    1(a0),d0    * baud rate
  49.     lea    _remap2,a1
  50.     move.b    (a1,d0.w),d0
  51.     ext.w    d0
  52.     move.w    d0,-(sp)    * baud rate to stack
  53.     move.w    #15,-(sp)
  54.     trap    #14
  55.     adda.w    #$e,sp        * clean up the stack    
  56.  
  57.     bsr    super        * into supervisor
  58.  
  59.     clr.w    d0
  60.     lea    _rsave,a0    * flow control
  61.     move.b    1(a0),d0    * get baud rate
  62.     cmp.b    #14,d0        * This code is necessary in order to fix
  63.     blt    no_bugfix    * the bug in the 11/20/85 release of the roms.
  64.     movea.l    #tdcr,a0    * Timer d+c control reg
  65.     move.b    (a0),d1        * involving baud rates of 50 and 75.
  66.     and.b    #$f0,d1        * mask out old value
  67.     or.b    #$02,d1        * or in new value
  68.     move.b    d1,(a0)        * stuff it in
  69.     movea.l    #tddr,a0    * a0 ->timer d data reg
  70.     cmp.w    #14,d0
  71.     bne    do_50
  72.     move.b    #102,(a0)    * set new data value for 75 baud
  73.     bra    no_bugfix
  74. do_50:
  75.     move.b    #154,(a0)    * set new data value for 50 baud
  76. no_bugfix:
  77.     movea.l    #ucr,a0
  78.     move.b    (a0),d0        * get ucr byte
  79.     lea    _rsave,a0
  80.     moveq    #0,d1
  81.     move.b    3(a0),d1    * bits/char
  82.     asl.b    #5,d1
  83.     and.b    #$99,d0        * clear bits 1,2,5,6
  84.     or.b    d1,d0
  85.     moveq    #0,d1
  86.     move.b    2(a0),d1    * parity
  87.     bne    prty1
  88.     bclr    #2,d0        * disable parity
  89.     bra    prtyout
  90. prty1:
  91.     bset    #2,d0        * enable parity
  92.     bclr    #1,d0        * clear odd/even
  93.     cmp.b    #2,d1
  94.     bne    prtyout        * since bit=0 odd parity
  95.     bset    #1,d0        * select even parity
  96. prtyout:
  97.     move.b    d0,ucr        * store new state
  98.     bsr unsuper
  99.     rts
  100.  
  101. * =================================================
  102. * GET INTO SUPERVISOR MODE
  103. * =================================================
  104.  
  105. super:
  106.     clr.l    -(sp)
  107.     move.w    #$20,-(sp)
  108.     trap    #1        * enter supervisor mode
  109.     addq.l    #6,sp
  110.     move.l    d0,savessp
  111.     rts
  112.  
  113. * =================================================
  114. * GET OUT OF SUPERVISOR MODE
  115. * =================================================
  116.  
  117. unsuper:
  118.     move.l    savessp,-(sp)
  119.     move.w    #$20,-(sp)
  120.     trap    #1            * return to user mode
  121.     addq.l    #6,sp
  122.     rts
  123.  
  124.  
  125. * ================================================
  126. *    data
  127. * ================================================
  128.  
  129.     .bss
  130. savessp:
  131.     .ds.l    1        *storage for supervisor stack pointer
  132.  
  133.     .end
  134.  
  135.